<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>上传图片</title>
</head>
<body>
<style type="text/css">
	.uploader-button{
		color:#444;
		border:1px solid #bbb;
		filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#e6e6e6,GradientType=0);
		background-color:rgb(245,245,245);
		border-radius:3px;
		font-weight: normal;
	}
</style>
 <script type="text/javascript">
 	var winUploadImage = new Windows("sys_uploader_image");
 	$(document).ready(function(){
		initUploader();
 	});
 	var _uploadResult = new JSONObject();
 	function initUploader(){
 		winUploadImage.find("#uploaderImage").uploadify({
	        height : 24,
	        swf : '$!basePath/framework/flash/uploadify.swf',
	        uploader : '$!basePath/admin/uploader/doUploadFile',
	        width : 120,
	        auto:false,
	       	buttonText:"选择图片",
	       	fileTypeDesc:"所有图片",
	        fileTypeExts:'*.jpg; *.jpeg; *.gif; *.png; *.bmp; *.psd',
	        buttonClass:'uploader-button',
	        formData:{"uploadType":"file"},
	        onUploadSuccess:function(file,data,response){
	        	data = JSONObject.parseJSON(data);
	        	if(data.result){
	        		_uploadResult.put(file.name, data.path);
	        	}
	        },
	        onQueueComplete:function(){
	        	winUploadImage.setReturnValue(_uploadResult);
	        	_uploadResult = new JSONObject();
				winUploadImage.close();
	        }
	    });
 	}
	function uploaderImage_ok(){
		winUploadImage.find("#uploaderImage").uploadify("upload","*");
  	}
  	function uploaderImage_cancel(){
  		_uploadResult = new JSONObject();
  		winUploadImage.find("#uploaderImage").uploadify("cancel","*");
  		winUploadImage.close();
  	}
 </script>
 <div class="easyui-layout" data-options="fit:true">
	 <div data-options="region:'center',border:false" style="background:#fff;padding-top:10px;padding-left:10px;">
	 	<div>
	 		<input id="uploaderImage" type="file"/>
	 	</div>
	 </div>
	 <!--Change Button Text-->
	 <div data-options="region:'south',border:false" style="text-align:center;padding:5px 0;">
		<a id="ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="uploaderImage_ok()">上传</a>
		<a id="cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="uploaderImage_cancel()">取消</a>
	</div>
 </div>
  </body>
</html>